import utils from './utils.js';

process.stdin.setEncoding('utf8');

process.stdin.on('data', (data) => {
    const req = JSON.parse(data);
    const funcName = req.method;
    const args = req.params;
    const result = utils[funcName](...args);

    const res = {
        jsonrpc: '2.0',
        id: req.id,
        result
    }

    process.stdout.write(JSON.stringify(res) + '\n');
})